
* All results reported in the paper running this code under STATA/SE 12.1
* Setting the path
global data "/Users/Guillem/Downloads/Riambau_Ostwald_Replication_Materials_PSRM"
cd "$data"

use  "Data_PSLE_Riambau_Ostwald_PSRM.dta" , clear
 
* creating variables that are needed for the regressions or the descriptive statistics
gen  years_school_NA = (years_school==99) if years_school!=.

gen  below40 = (age<4) if age<99   // Respondents who are 40 years of age or below
gen  above60 = (age>5) if age<99   // Respondents who are 61 years of age or above

gen  secondaryorless = (education <3) if education <99    // Respondents who have a secondary school degree at most
gen  BAorabove = (education >4) if education <99          // Respondents who have a BA or higher degree  

********************************************************************************
*                                                                              *
*                                                                              *
*                             Main Manuscript                                  *
*                                                                              *
*                                                                              *
********************************************************************************

 
** Table 1 Main Manuscript
**************************

* Whole sample
sum LIST if placebo==0  
sum LIST if placebo==1  
ttesti    611    1.767594    .8861395   667    1.890555    .9917153  // one-sided p-value: 0.0100

* (Excluding temporary residents for political knowledge)
sum LIST if placebo==0 &  PK==0 & citizen_status!=4  
sum LIST if placebo==1 &  PK==0 & citizen_status!=4   
ttesti    352    1.735795    .9096334    429     1.90676    .9979774   // one-sided p-value: 0.0067 

sum LIST if placebo==0 &  PK==1 & citizen_status!=4  
sum LIST if placebo==1 &  PK==1 & citizen_status!=4     
ttesti  212    1.834906    .8238785 193     1.92228     .951518  // one-sided p-value: 0.1614 

* Education
sum LIST if placebo==0 & education ==1
sum LIST if placebo==1 & education ==1
ttesti 73    1.671233    .9287805 77    1.779221    1.119485  // one-sided p-value: 0.2612 

sum LIST if placebo==0 & education ==2
sum LIST if placebo==1 & education ==2
ttesti 138    1.688406    .8440494 153    1.960784    1.025224   // one-sided p-value: 0.0073   

sum LIST if placebo==0 & (education ==5 |education==6 |education==7)
sum LIST if placebo==1 & (education ==5 |education==6 |education==7)
ttesti 218     1.87156    .8861548     243    1.781893    .8940583    // one-sided p-value: 0.8596 

			* Proposal for change:
			* No College
			sum LIST if placebo==0 & (education ==1 |education==2 |education==3) | (education==4 & student==0)
			sum LIST if placebo==1 & (education ==1 |education==2 |education==3) | (education==4 & student==0)
			ttesti  399    1.724311    .8706178    436    1.944954    1.035773      // one-sided p-value: 0.0005 
			display(1.944954 - 1.724311)
			
			* College (inludes college students)
			sum LIST if placebo==0 & (education ==5 |education==6 |education==7) |(education==4 & student==1)
			sum LIST if placebo==1 & (education ==5 |education==6 |education==7) |(education==4 & student==1)
			ttesti  230    1.847826    .8955833   255    1.764706    .9003113    // one-sided p-value: 0.8454          
			display(1.847826- 1.764706)
			
* HHD income
sum LIST if placebo==0 & (income ==1 | income ==2)
sum LIST if placebo==1 & (income ==1 | income ==2)
ttesti 210    1.690476    .8773627  233    1.982833    1.046199 // one-sided p-value: 0.0008 

sum LIST if placebo==0 & (income >2 & income<99)
sum LIST if placebo==1 & (income >2 & income<99)
ttesti 352    1.869318    .8770396   382    1.861257    .9329863   // one-sided p-value: 0.5479  

* Age 
sum LIST if placebo==0 & above60 ==1 & age<99
sum LIST if placebo==1 & above60 ==1 & age<99
ttesti  103    1.699029    .8023856    109    1.972477    1.013417 // one-sided p-value: 0.0156   

sum LIST if placebo==0 & above60 ==0 & age<99
sum LIST if placebo==1 & above60 ==0 & age<99
ttesti  500        1.79    .8963855 550        1.88    .9826176   // one-sided p-value: 0.0613 

 
** Table 2 Main Manuscript
**************************

global controls i.placebo##i.Chinese i.placebo##ib0.female  i.placebo##i.apt_size   
 	
		* [Note: District_FE are the dummies for electoral district] 
		 
        * Columns 1-4 [no controls]
        reg   LIST   i.placebo##ib0.age61_or_older        ib2.District_FE, vce(cluster District_FE)        
        reg   LIST   i.placebo##c.years_school            ib2.District_FE, vce(cluster District_FE)        	
        predict prediction_school
        reg   LIST   i.placebo##i.PK                      ib2.District_FE, vce(cluster District_FE)  
        reg   LIST   i.placebo##c.hhd_income_in_thousands ib2.District_FE if hhd_income_in_thousands <99   , vce(cluster District_FE)     // excluding 99=No Answer

        * Columns 5-8 [with controls]
        reg   LIST   $controls i.placebo##ib0.age61_or_older           ib2.District_FE  , vce(cluster District_FE)  
        reg   LIST   $controls i.placebo##c.years_school               ib2.District_FE  , vce(cluster District_FE)  
        reg   LIST   $controls i.placebo##i.PK                         ib2.District_FE  , vce(cluster District_FE)  
        reg   LIST   $controls i.placebo##c.hhd_income_in_thousands    ib2.District_FE if hhd_income_in_thousands <99   , vce(cluster District_FE)     // excluding 99=No Answer
       
        * Column 9 [all included]
        
        reg   LIST   $controls i.placebo##ib0.age61_or_older i.placebo##c.years_school i.placebo##i.PK i.placebo##c.hhd_income_in_thousands    ib2.District_FE if hhd_income_in_thousands <99   , vce(cluster District_FE)     // excluding 99=No Answer
        predict prediction1   // to be used below in Figure 1
 
 
* Comments in page 6 (Section 3: Results)
***************************************** 
display(1.890555-1.767594)  // 12% 

tab LIST if placebo==0       // Footnote 8 [1st paragraph, Section 3]
tab LIST if placebo==1       // Footnote 8 [1st paragraph, Section 3]  
display(6.22+2.45)           // Footnote 8 [1st paragraph, Section 3]
display(6.90+3.30+1.35)      // Footnote 8 [1st paragraph, Section 3]

                            //  [A bit later in Section 3, "Results also suggest that, on average, respondents with only
                            //   a primary school education report  0.32  more true items when presented with the placebo statement."] 
display(1.474133 + .4634431 +.0166075*6 -.0239595*6)     // [1.8934641] Average 5-item for those with primary school title (6 years of schooling). Using results from column 2 in Table 2.
display(1.474133            +.0166075*6           )      // [1.573778]  Average 4-item for those with primary school title (6 years of schooling). Using results from column 2 in Table 2.
display(1.8934641-1.573778)                              // [.3196861]  Average difference response for respondents with primary school title. 

display(1.474133 + .4634431 +.0166075*20 -.0239595*20)     // [1.7905361] Average 5-item for those with college degree (20 years of schooling). Using results from column 2 in Table 2.
display(1.474133            +.0166075*20           )       // [1.806283]  Average 4-item for those with college degree (20 years of schooling). Using results from column 2 in Table 2.
display(1.7905361-1.806283)                                // [-0.0157469]  Average difference response for respondents with college degree. 

 
** Figure 1 Main Manuscript
***************************

		 * Figure 1A
		 lpoly    prediction1      years_school  if placebo==1 & years_school <99  , ci level(95) bw(3) nosca   degree(3)  msize(vtiny) kernel(gauss) ///    
         title("Placebo 5-item Control", size(vlarge)) subtitle("Predicted response, by education") xtitle("Years of schooling", size(large))  ytitle("") /// 
         xlabel(6 (4) 24,labsize(large))  xmtick(##2) ylabel(1.5 (.25) 2.25,labsize(large)) ymtick(##2) mlabsize(large)     ///     
		 graphregion(color(white))  note("kernel = gauss, degree = 3, bandwidth = 3", size(medium))   legend(off)       

		 
		 * Figure 1B
		 lpoly    prediction1      years_school  if placebo==0 & years_school <99, ci level(95) bw(3) nosca   degree(3)  msize(vtiny) kernel(gauss) ///    
         title("Standard 4-item Control", size(vlarge)) subtitle("Predicted response, by education") xtitle("Years of schooling", size(large))  ytitle("") /// 
         xlabel(6 (4) 24,labsize(large))  xmtick(##2) ylabel(1.5 (.25) 2.25,labsize(large)) ymtick(##2) mlabsize(large)     ///     
		 graphregion(color(white))  note("kernel = gauss, degree = 3, bandwidth = 3", size(medium))   legend(off)       

		 
		 * Figure 1C
		 lpoly    prediction1      hhd_income_in_thousands  if placebo==1 & hhd_income_in_thousands <99, ci level(95) bw(3) nosca   degree(3)  msize(vtiny) kernel(gauss) ///    
         title("Placebo 5-item Control", size(vlarge)) subtitle("Predicted response, by income") xtitle("Household income (in thousands of dollars)", size(large))  ytitle("") /// 
         xlabel(0 (4) 20,labsize(large))  xmtick(##2) ylabel(1.5 (.25) 2.25,labsize(large)) ymtick(##2) mlabsize(large)   ///
		 graphregion(color(white))  note("kernel = gauss, degree = 3, bandwidth = 3", size(medium))   legend(off)       

		 
		 * Figure 1D
		 lpoly    prediction1     hhd_income_in_thousands  if placebo==0 & hhd_income_in_thousands <99, ci level(95) bw(3)  nosca  degree(3)  msize(vtiny) kernel(gauss) ///    
         title("Standard 4-item Control", size(vlarge)) subtitle("Predicted response, by income") xtitle("Household income (in thousands of dollars)", size(large))  ytitle("") /// 
         xlabel(0 (4) 20,labsize(large))  xmtick(##2) ylabel(1.5 (.25) 2.25,labsize(large)) ymtick(##2) mlabsize(large)   ///
		 graphregion(color(white))  note("kernel = gauss, degree = 3, bandwidth = 3", size(medium))   legend(off)       

		 
 

* Pooling result in page 13 (Conclusions)
***************************************** 
display(1.890555*667 + 336*1.91+ 300*0.77+ 1528*.9613874 + 743*1.86)   //  4984.7401
display(667+336+300+1528+743)   //  3574
display((1.890555*667 + 336*1.91+ 300*0.77+ 1528*.9613874 + 743*1.86)/(667+336+300+1528+743))   //  1.394723
display(1.767594*611 + 301*0.69 + 336*1.9 + 0.899*1478 + 1.77*769)    // 4615.9419
display(611 + 301 + 336 + 1478 + 769)  // 3495
display((1.767594*611 + 301*0.69 + 336*1.9 + 0.899*1478 + 1.77*769)/(611 + 301 + 336 + 1478 + 769))  // 1.3207273
display(1.394723 - 1.3207273)  // .0739957


********************************************************************************
*                                                                              *
*                                                                              *
*                         Supplementary Materials                              *
*                                                                              *
*                                                                              *
********************************************************************************

* Data described in section 1
*****************************
		 tab placebo
		 tab Help  
		 tab Language_survey  
		 tab Language_survey if ethnicity==1  
		 tab Language_survey if ethnicity==2  
		 
		 tab citizen_status if LIST!=.  // Note: this is for paragraph 1 in section 3.1
		 
		 
** Figure 1 Supplementary Materials
***********************************
		 
		 hist LIST if placebo==0, percent	addlabels addlabopts(yvarformat(%4.2f) mlabsize(medium)) xlabel(0 (1) 5,labsize(large))  w(.31) ytitle(% Respondents, size(vlarge))  color(emerald)  graphregion(color(white))    ///
         title("Standard 4-item Control (N=611)", size(vlarge)) subtitle("") xtitle("Number reported", size(large))  ylabel(0 (10) 50,labsize(large))  mlabsize(large)  ///
         note("Number above bars: % of total", size(large))  
 
 
		 hist LIST if placebo==1, percent	addlabels addlabopts(yvarformat(%4.2f) mlabsize(medium)) xlabel(0 (1) 5,labsize(large))  w(.31) ytitle(% Respondents, size(vlarge))  color(emerald)  graphregion(color(white)) ///
         title("Placebo 5-item Control (N=667)", size(vlarge)) subtitle("") xtitle("Number reported", size(large))  ylabel(0 (10) 50,labsize(large))  mlabsize(large)  ///
         note("Number above bars: % of total", size(large))  

		 
 
** Table 1 Supplementary Materials
**********************************

	* [Note: excluding temporary residents as they are not in the official statistics]

	tab above60 if  citizen_status!=4 & placebo==0  
	tab above60 if  citizen_status!=4 & placebo==1
	
	tab below40 if  citizen_status!=4 & placebo==0
	tab below40 if  citizen_status!=4 & placebo==1

	tab ethnicity if  citizen_status!=4 & placebo==0
	tab ethnicity if  citizen_status!=4 & placebo==1

	tab female if  citizen_status!=4 & placebo==0  
	tab female if  citizen_status!=4 & placebo==1  

    tab rooms if  citizen_status!=4 & placebo==0 
	tab rooms if  citizen_status!=4 & placebo==1

    tab car if  citizen_status!=4 & placebo==0
	tab car if  citizen_status!=4 & placebo==1
	
    tab employed if  citizen_status!=4 & placebo==0
	tab employed if  citizen_status!=4 & placebo==1	
	
    tab civil_servant if  citizen_status!=4 & placebo==0
	tab civil_servant if  citizen_status!=4 & placebo==1	
	
    tab secondaryorless if  citizen_status!=4 & placebo==0
	tab secondaryorless if  citizen_status!=4 & placebo==1	
	
    tab BA if  citizen_status!=4 & placebo==0 & LIST!=.
	tab BA if  citizen_status!=4 & placebo==1 & LIST!=.
	
    tab PK if  citizen_status!=4 & placebo==0 & LIST!=.
	tab PK if  citizen_status!=4 & placebo==1 & LIST!=.
	
 	tab placebo
	
** Table 3 Supplementary Materials
**********************************
	
    sum LIST if particpationRC==0  & placebo==0	
	sum LIST if particpationRC==0  & placebo==1	
 	display(1.871287-1.722426)  // .148861
 
    sum LIST if particpationRC==1  & placebo==0	
	sum LIST if particpationRC==1  & placebo==1	
	display(2.116279-2.291667)    //  -.175388
	
	
** Table 4 Supplementary Materials
**********************************	

// (for Table 4, see R code "R_Replication_File_PSLE")
	

** Table 5 Supplementary Materials
**********************************	
	
// (for Table 5, see separate Stata do file "PSLE_Replication Ahlquist et al 2014")
	

** Table 6 Supplementary Materials
**********************************	

** Columns 1-3 (results for Singapore)
sum LIST if placebo==0  
sum LIST if placebo==1  
display(1.890555-1.767594) // .122961 (rounding: 0.12)

** First, calibrate Holbrook & Krosnick 's standard deviations to match their reported t-statistic
ttesti  743 1.86 1.3   769 1.77 1.2  // Holbrock Krosnick, the S.D. are calibrated to match their reported t-statistic of t(1,510)=1.40

** P-values [column 3]
ttesti     667    1.890555 .9917153    611    1.767594    .8861395  // SGP: Pr(T > t) = 0.0100
// Uruguay   THEY REPORT 0.181   [Table 1, p.670]
// Honduras  THEY REPORT 0.497   [Table 1, p.670]
ttesti  1528  .9613874  1.044122 1472 .8994565  .8990967 // Pr(T > t) = 0.0412; USA-Ahlquist et al., see separate Stata do file "PSLE_Replication Ahlquist et al 2014"
ttesti  743 1.86 1.3   769 1.77 1.2  // Pr(T > t) = 0.0809; USA-Holbrock Krosnick 

** Power computations: Assume effect size is what is observed 
sampsi  1.767594  1.890555, n1(611) n2(667)  sd1(.8861395) sd2(.9917153) a(0.05)  onesided  // 0.7567; Singapore 
sampsi  0.69 0.77, n1(301) n2(300)  sd1(.89) sd2(.89) a(0.05) onesided // Uruguay
sampsi  1.90  1.91, n1(336) n2(336)  sd1(1.19) sd2(1.19) a(0.05) onesided // Honduras
sampsi  0.899  0.961, n1(1478) n2(1528)  sd1(0.899) sd2(1.04) a(0.05) onesided // USA -- Ahlquist et al.
sampsi  1.77  1.86, n1(769) n2(743)  sd1(1.2) sd2(1.3) a(0.05) onesided // USA -- HK  [power =   0.4023]
 
** Power computations: Assume effect size is 10% 
sampsi  1.767594  1.867594, n1(611) n2(667)  sd1(.8861395) sd2(.9917153) a(0.05)  onesided  // 0.6021; Singapore
sampsi  0.69  0.79, n1(301) n2(300)  sd1(.89) sd2(.89) a(0.05) onesided  // Uruguay
sampsi  1.90  2.00, n1(336) n2(336)  sd1(1.19) sd2(1.19) a(0.05) onesided // Honduras
sampsi  0.899  0.999, n1(1478) n2(1528)  sd1(0.899) sd2(1.04) a(0.05) onesided  // USA 
sampsi  1.77  1.87, n1(769) n2(743)  sd1(1.2) sd2(1.3) a(0.05) onesided // USA -- HK 

 
** Generate dummy variables to export dataset to R
**************************************************

gen      female_NA = (female==99) if female!=.
gen      female_dummy  = (female==1) if female!=.
gen      age_NA = (age61_or_older==99) if age61_or_older!=.
gen      age_61plus = (age61_or_older==1) if age61_or_older!=.
gen      apt_1_2_room = (apt_size==1) if apt_size!=.
gen      apt_3_4_room = (apt_size==2) if apt_size!=.
gen      apt_5plus_room = (apt_size==3) if apt_size!=.
replace  age61_or_older = . if hhd_income_in_thousands==99  
replace  female = . if female ==99  
replace  hhd_income_in_thousands = . if hhd_income_in_thousands==99  

* save  "path/Data_R_PSLE.dta", replace   // then convert using STATTRANSFER
 
	
 
	
	
	
	
	
